package lab02.test11;

public class Rectangle implements Printx {
     double grow;
     double wide;
     private double perimeter;
     private double area;

     public  Rectangle(){}

    public Rectangle(double grow,double wide){

        this.grow=grow;
        this.wide=wide;
    }

    public double getGrow() {
        return grow;
    }

    public void setGrow(double grow) {
        this.grow = grow;
    }

    public double getWide() {
        return wide;
    }

    public void setWide(double wide) {
        this.wide = wide;
    }

    private double getPerimeter() {
        perimeter=2*(grow+wide);
        return perimeter;
    }

    public void setPerimeter(double perimeter) {
        this.perimeter =  perimeter;
    }

    private double  getArea() {
        area=grow*wide;
        return area;
    }

    public void setArea(double area) {
        this.area = area;
    }

    @Override
    public void printMyWay() {
        System.out.println("边长："+grow+"\t"+wide+"\n"+"周长："+getPerimeter()+"\n"+"面积："+getArea());
    }
}
